<?php

namespace App\Http\Controllers;

use App\Services\SystemConfigService;
use \Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

/**
 * Class CompanyController
 * @package App\Http\Controllers
 */
class SystemConfigController extends Controller
{
    public $systemConfigService;

    public function __construct(SystemConfigService $systemConfigService)
    {
        parent::__construct();
        $this->systemConfigService = $systemConfigService;
    }

    /**
     * 获取配置信息
     * @return JsonResponse
     */
    public function show()
    {
        $info = SystemConfigService::getInfo();

        return $this->success($info);
    }

    /**
     * 更新数据
     * @param Request $request
     * @return JsonResponse
     */
    public function update(Request $request)
    {
        $this->systemConfigService->updateData($request->all());

        return $this->success('', '保存成功!');
    }

}
